namespace KanbanBoard.Tests.ApplicationSetup
{
    using SharpArch.Core.DomainModel;
    using SharpArch.Core.PersistenceSupport;
    using SharpArch.Data.NHibernate;
    using SharpArch.Testing.NUnit;

    public class DataPartBase
    {
        protected void SaveData<T>(T[] list) where T : Entity
        {
            foreach (var entity in list)
            {
                this.SaveData(entity);
            }
        }

        protected void SaveData<T>(T entity) where T : Entity
        {
            IRepository<T> repository = new Repository<T>();
            entity.IsValid().ShouldBeTrue();
            repository.SaveOrUpdate(entity);
            repository.DbContext.CommitChanges();

        }
    }
}